import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { THolidayRetConfig } from "../../../Message/Db/Tables/THolidayRetConfig";
import { DateParser } from "../../common/tools/DateParser";
//class HolidayReturnConfig
    
    export  class HolidayReturnConfig
    {
        constructor()
        {
            
            this._giftArr = [];
            if (HolidayReturnConfig._instance != null) 
            {
                throw new Error(" HolidayReturnConfig 单例 ");
            }
            this.init();
            return;
        }

        public HolidayReturnConfig.get giftArr(): Array<any>
        {
            this._giftArr.sortOn("id", Array.NUMERIC);
            return this._giftArr;
        }

        public init(): void
        {
            var loc1=null;
            loc1 = ConfigManager.instance.getJSONByFileName("t_holiday_ret_config.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new THolidayRetConfig();
                loc1.id = loc2.id;
                loc1.activeDt = DateParser.strToDateNormal(loc2.activeDt as string);
                loc1.giftBagCode = loc2.giftBagCode;
                this._giftArr.push(loc1);
            }
            return;
        }

        public static get instance(): HolidayReturnConfig
        {
            if (!HolidayReturnConfig._instance) 
            {
                HolidayReturnConfig._instance = new HolidayReturnConfig();
            }
            return HolidayReturnConfig._instance;
        }

        /* internal */ /* var */_giftArr: Array<any>;

        /* internal */ static /* var */_instance: HolidayReturnConfig;
    }
